/**
 * 数学求和
 * @param a 被加数
 * @param b 加数
 * @returns a b之和
 */
const add = (a: number, b: number) => a + b
console.log(add(2, 3));


// 自动类型推导
const hello = "Hello World!";


/* 枚举 */
// enum Gender {
//     MALE, // 男
//     FEMALE, // 女
//     GAY, // 基佬
//     LESBIAN, // 女同
//     ABNORMAL, // 死变态
// }
enum Gender {
    MALE = "MALE", // 男
    FEMALE = "FEMALE", // 女
    GAY = "GAY", // 基佬
    LESBIAN = "LESBIAN", // 女同
    ABNORMAL = "ABNORMAL", // 死变态
}


/* 接口 规定对象应该长成什么样子 */
interface Person {
    name: string,
    age: number,
    hobbies: string[],
    gender: Gender
}

const p1: Person = {
    name: "张三",
    age: 18,
    hobbies: ["女", "撸代码", "撸铁"],
    // wife: null,
    gender: Gender.GAY
}

/* 泛型 */
type Team<T> = Array<T>
const zhuriheLanjun: Team<Object> = [
    {
        name: "张三",
    },
    {
        name: "张三三",
    }
]

/* 元组 特定类型组合而成的数组 顺序+类型+数量都严格规定 */
interface Dog {
    name: string,
    type: string
}
const choupi = {
    name: "诸葛亮",
    type: "宇宙哈"
}
const maomi = {
    name: "猫咪",
    type: "德国牧羊犬"
}

type Danshengouzhijia = [Person, Dog]

const kunzhijia: Danshengouzhijia = [
    p1,
    choupi,
    // maomi
]
